<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>绘制的两条直线</title>
<style type="text/css">
canvas {
	border:1px solid #000;
}
</style>
<script type="text/javascript">
function DrawLine(){
	var canvas=document.getElementById("canvas");
	var context = canvas.getContext("2d");
	// 创建绘制过程
	context.beginPath();
	context.moveTo(50,50);
	context.lineTo(120,120);
	context.lineTo(120,60);
	context.closePath();
	context.lineTo(100,120);
	context.strokeStyle="#000";
	// 执行绘制
	context.stroke();
}
window.addEventListener("load",DrawLine,true);
</script>
</head>
<body style="overflow:hidden">
<canvas id="canvas" width="400" height="300">你的浏览器不支持该功能！</canvas>
</body>
</html>
